package priv.pattern.commandmode.notoperation.service.impl;

/*
 * 作者：m鹏h
 * 时间；2024/8/8 23:39
 * 描述：加法命令
 **/

import priv.pattern.commandmode.notoperation.Processor;
import priv.pattern.commandmode.notoperation.service.Command;



public class AddCommand implements Command {

 /**
  * 持有真正进行运算操作的对象
  */
 private Processor processor;

 /**
  * 要加上的数值
  */
 private int number;

 public AddCommand(Processor processor, int number) {
  this.processor = processor;
  this.number = number;
 }

 @Override
 public void execute() {
  this.processor.add(number);
 }

 @Override
 public void undo() {
  this.processor.substract(number);
 }

}

